package com.example.com.skills_utf8;

import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.RadioGroup;

import com.app.BaseActivity;
import com.app.net.NetHelper;
import com.app.util.Utils;
import com.app.util.Utils_Dialog;
import com.baidu.location.BDLocation;
import com.utils.g;

import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;

import java.lang.ref.WeakReference;
import java.util.ArrayList;


public class _62RegisterActivity extends BaseActivity {

    _62RegisterActivity activity = this;
    Button btn_submit;

    RadioGroup radiogroup;
    FrameLayout layout_content;


    int check_id;
    int type;


    /*
    BDLocation bd;
    private static class MyHandler extends Handler
    {

        private final WeakReference<Activity> link;
        public MyHandler(Activity activity) {
            link = new WeakReference<Activity>(activity);
        }


        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);

            _62RegisterActivity activity = (_62RegisterActivity)link.get();
            if(activity != null){

                activity.bd = (BDLocation)msg.obj;

                ApplicationCustom.getInstance().location.OnStop();

            }






        }
    }
    */



    @Override
    public Integer InitLayout() {
        return R.layout.activity__62_register;
    }

    @Override
    public void InitView() {

        radiogroup = (RadioGroup)findViewById(R.id.radiogroup);
        btn_submit = (Button)findViewById(R.id.btn_submit);

        layout_content = (FrameLayout)findViewById(R.id.layout_content);

    }

    @Override
    public void InitListener() {

    }

    @Override
    public void InitProcess() {



        radiogroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {

                check_id = checkedId;


                FragmentManager manager = getSupportFragmentManager();
                FragmentTransaction ft = manager.beginTransaction();
                if (check_id == R.id.rb_voice) {
                    ft.replace(R.id.layout_content,  new _62RegisterVoiceFragment());
                } else if (check_id == R.id.rb_pic) {
                    ft.replace(R.id.layout_content, new _62RegisterPicFragment());
                } else if (check_id == R.id.rb_location) {
                    ft.replace(R.id.layout_content, new _62RegisterLocationFragment());
                }
                ft.commit();


            }
        });




        radiogroup.check(R.id.rb_location);




    }




    void do_pic(){
        type = 1;

    }




    void requestNetData_voice(){

    }

    void requestNetData_pic(){

    }






}
